home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 4 / Amiga Tools 4.iso / tools / system-tools / sort1.45e / sort.doc < prev    next >
Text File  |  1996-02-26  |  8KB  |  215 lines

  1. sort.doc    sort Version 1.45        by Rüdiger Werner
  2.  
  3. The program and files in this distribution are freely distributable.
  4. No commercial usage is permitted without written permission from the
  5. author. Everything in this distribution must be kept together, in original
  6. unmodified form.
  7.  
  8.                       *************************
  9.  
  10. ***********************************************************************
  11. * Notice that the author can't be made responsible for the destroying *
  12. * or lost of data through use of this program. You use it on your own *
  13. * risc. Please read carefully the Doc-file before using.              *
  14. ***********************************************************************
  15.  
  16.  
  17. This copy is not registered. For registration send a letter with 5 US$ or
  18. the equivalent in DM to the below mentioned address. If you give an e-mail
  19. address, you will get the registered version via this medium. Otherwise
  20. include an addressed and franked envelope (2DM within Germany) or
  21. two more US$ for shipping. Send cash only, for checks add 5 US$ for the
  22. charges of the bank.
  23.  
  24.                       *************************
  25.  
  26. Please contact me if you have any comments or suggestions:
  27.  
  28.  E-Mail:  rw2@irz.inf.tu-dresden.de
  29.       wernerr@iee1.et.tu-dresden.de
  30.  
  31.  URL:      http://home.pages.de/~wernerr
  32.       http://www.inf.tu-dresden.de/~rw2
  33.       http://eeetw0.et.tu-dresden.de:8080/~wernerr
  34.  
  35.  Snail
  36.  Mail:      Rüdiger Werner
  37.       Stresemannplatz 2
  38.       01309 Dresden
  39.       GERMANY
  40.  
  41.  
  42. CHANGES TO LAST VERSION
  43.  
  44. loading speed increased
  45. sorting time reduced downto 10 per cent or less
  46. no (recognizable) time is needed anymore for freeing the memory
  47. -c option changed
  48. -C option added
  49. -i option added
  50. -S option added
  51. -v option added
  52.  
  53. Description
  54. -----------
  55.  
  56. The program was written for use in Shell only.
  57. It is started either by simply typing it's name (of course it should be
  58. in the current directory or in the path) or by giving additionally switches
  59. and/or the name of the file what should be sorted.
  60.  
  61.  sort [switches] infile [infile 2 ... ] [outfile]
  62.  
  63. By typing 'sort ?' appears a short help.
  64. The specified file is opened and red into the memory. There it will be
  65. sorted and, if any switches were set, manipulated in the required way.
  66.  
  67. Explanation of the switches (alphabeticially order):
  68.  
  69. NOTE: In the unrgistered version only the -a, -e and -g switches are working.
  70. -----------------------------------------------------------------------------
  71.  
  72. -a    sorting the file in ascending order (it is optional, because default)
  73.  
  74. -c[z,l]    with this option the number 'z' of column can be specified, by which
  75.     the file is to be sorted. 'l' specifies, how many chars are used for
  76.     sorting.
  77.     This is useful e.g. to sort the RECENT files from Aminet by type.
  78.     (-c20,10)
  79.     If double lines are erased, the comparision starts at the FIRST char
  80.     of the lines, means the whole line is used for comparision.
  81.     If 'l' is not given, it will be asked for, if 'l' given as '0' it
  82.     will be set automatical to maximum line length
  83.  
  84. -C[z,l]    see above
  85.     The difference is, that the comparision for erasing double
  86.     lines starts at the column, which is specified for sorting.
  87.     comparision is made till end of the line, the number of chars
  88.     for sorting doesn't have any influence.
  89.  
  90. -d    sorting the file in descending order
  91.  
  92. -e    all empty lines will be erased.
  93.  
  94. -E    all empty lines and all identical lines in the file will be erased
  95.     after sorting (of course ONE of these lines is kept in the file).
  96.  
  97. -f[y]    using this option the first line of the work range can be specified
  98.     If this option is given, ALL actions are done ONLY within this range.
  99.     To give also the last line is not compelling.
  100.     If y is bigger than the number of lines of the internal file
  101.     (all in-read files together) an error-message appears and the
  102.     program is cancelled.
  103.  
  104. -g    actually the capitals and small letters are distinguished.
  105.     by setting this switch, they won't be distinguished.
  106.  
  107. -i[str]    the given string is ignored for sorting, if it appears
  108.     on the beginning of the sorting column. It's NOT removed!
  109.     if spaces are in the string, it's advicable to give the -i
  110.     option only in the command line and answer the request.
  111.     For deleting the full line is used for comparision.
  112.  
  113. -j[x]    joins x files and sorts them; the resulting file will be
  114.     written to <outfile>.
  115.  
  116. -J[x]    joins x files without sorting; the resulting file will be
  117.     written to <outfile>.
  118.  
  119. -l[y]    using this option the first line of the work range can be specified
  120.     If this option is given, ALL actions are done ONLY within this range.
  121.     To give also the first line is not compelling.
  122.     if y is bigger than the number of lines of the internal file
  123.     (all in-read files together) the last line of the file is
  124.     automatically taken as last line of the range.
  125.  
  126.     if x or/and y is not given it will be asked for
  127.  
  128. -n    the file is not sorted, only empty lines are erased.
  129.  
  130. -N    the file is not sorted, only empty lines and identical lines which
  131.     are side by side are erased (of course ONE line is kept in the file).
  132.     Note that it might more useful if the file is already sorted.
  133.  
  134. -o    the specified file for reading will be overwritten by the sorted
  135.     file.
  136.     BE CAREFUL!!! IF ONCE OVERWRITTEN THE ORIGINAL FILE CAN'T BE RESTORED!!!
  137.  
  138. -p[str]    all lines, which doesn't match the search pattern str will be removed.
  139.     note: if characters like " are given it is advisable to give
  140.     this switch as the very last of the command line. The reason is that
  141.     the following arguments are not recognized after a " by the programm.
  142.  
  143. -P[str]    all lines, which match the search pattern str will be removed
  144.     note: see -p
  145.  
  146. -r    the file which was red will only be written in reverse order of lines
  147.     without any other actions
  148.  
  149. -s[c]    with this option the character c will be removed from the file/range.
  150.     note: if characters like " need to be removed it is advisable to give
  151.     this switch as the very last of the command line. The reason is that
  152.     the following arguments are not recognized after a " by the programm.
  153.  
  154. -S[cd]    with this option the char c will be replaced by char d in the
  155.     file/range.
  156.     note: see -s[c]
  157.  
  158. -v    this option supresses all messages, including the warning, that the
  159.     outfile already exists.
  160.     Only error messages will appear.
  161.  
  162. -x    the sorting function will be disabled
  163.  
  164.  
  165. some examples:
  166.  
  167. sort textfile1
  168. asks for the outfilename and loads textfile1. After sorting it will be
  169. written to outfile
  170.  
  171. sort textfile1 text.out -g
  172. loads textfile1 without distinguishing capitals and small letters and
  173. writes the sorted file to text.out 
  174.  
  175. sort textfile1 textfile2 -j3 textfile3 ram:text.out -E
  176. loads textfile1 textfile2 and textfile3 sorts, removes all empty lines
  177. and all identical lines (except of one of them) and writes the
  178. list to RAM:text.out
  179.  
  180. sort RECENT RECENT.sort -E -c20,10 -g -f6
  181. is the common command line to sort the RECENT files from Aminet
  182. sorting starts at line 6, means the header is not touched
  183. it is sorted after the types of the files, additionally the entries
  184. are sorted after the first column
  185. empty lines and identical lines are deleted
  186. (the whole line is used for comparision)
  187.  
  188.                 ******
  189.  
  190. The switches can be set at any place after the program name.
  191. If the parameter to the switch is not given, it will be asked for.
  192. The program detects contradictions between given switches to avoid possible
  193. mistakes from the user
  194.  
  195. Notice that the outfilename has to be the last of all filenames.
  196. If no outfilename is given, the first infilename plus a new ending is used
  197. for a suggestion for the outfilename.
  198.  
  199. The sort-order bases on the strcmp/stricmp function.
  200.  
  201. The maximum length of a line in a file is 1024 byte.
  202. All bytes that a line is longer than this are cutted. A message appears in
  203. this case. If you need to sort longer lines, just send me a mail.
  204.  
  205. The size of the file to be sorted depends only on the size of the available
  206. memory (and on your patience). The used time is shown after sorting, just
  207. for your statistics ...
  208. The sort_engl file is the same as the sort file, just all messages appear
  209. in English.
  210.  
  211. I'd be grateful for any comments, suggestions and bug reports.
  212.  
  213.  
  214. Rüdiger Werner
  215.